package com.swt.shoppingmall.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by swt on 2016/12/26.
 */
public class CacheUtils {

    public static final String SHOPPING_MALL = "ShoppingMall";

    public static String getString(Context mContext, String key) {
        SharedPreferences sp = mContext.getSharedPreferences(SHOPPING_MALL, Context.MODE_APPEND);

        return sp.getString(key, "");
    }

    /**
     * 保存String类型的数据
     *
     * @param mContext
     * @param key
     * @param value
     */
    public static void saveString(Context mContext, String key, String value) {
        SharedPreferences sp = mContext.getSharedPreferences(SHOPPING_MALL, Context.MODE_APPEND);
        sp.edit().putString(key, value).commit();
    }
}
